<template>
	<view>
		<view class="head">
			<view class="head_left" @tap="back()">
				<image src="../../../static/wode/return.png" mode=""></image>
			</view>
			<view class="head_mid">
				{{title}}
			</view>
			<view class="head_left">

			</view>
		</view>
		<view class="padding-box">
			<view class="item" v-if="type=='xiangqing'">
				<view class="item_left">
					<text>《聊聊历史和神话》</text>
				</view>
				<view class="item_right">
					<text class="magin2">5月5日</text>
					<text>8:00-8:30</text>
				</view>
			</view>
			<view class="" v-else>
				<view class="item" v-for="(item,index) in summaryList" :key="index">
					<view class="item1_left">
						<text>《{{item.title}}》</text>
						<text class="magin2">{{item.time}}</text>
						<!-- <text>8:00~8:30</text> -->
					</view>
					<text class="text2" @tap="toDetail(item.id)">课程总结</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				type: '',
				summaryList: '', //总结列表
			}
		},
		onLoad(option) {
			if (option.type != undefined) {
				this.type = option.type;
				if (this.type == 'xiangqing') {
					this.title = option.name
				} else if (this.type == 'zongjie') {
					this.title = '课程总结'
					this.getSummary()
				}
			}
		},
		methods: {
			back() { //返回
				uni.navigateBack({
					delta: 1
				})
			},
			getSummary() {
				var me = this
				var data = {
					user_id: uni.getStorageSync('user_id'),
					status: '3'
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'userAppointment',
					actionName: 'querySummaryListPage',
					data: data,
					successBack: function(res) {
						// console.log(res.data.data, '课程总结')
						me.summaryList = res.data.data
						for (var i = 0; i < me.summaryList.length; i++) {
							me.summaryList[i].start_time = me.summaryList[i].start_time.split(' ')
							me.summaryList[i].end_time = me.summaryList[i].end_time.split(' ')
							me.summaryList[i].time = me.summaryList[i].start_time[0].substr(2, 8) + ' ' + me.summaryList[i].start_time[1]
								.substr(0, 5) + '~' + me.summaryList[i].end_time[1].substr(0, 5)
						}
						console.log(me.summaryList, '课程总结')

					}
				})

			},
			toDetail(id) {
				uni.navigateTo({
					url: '/pages/My/summaryDetail/summaryDetail?type=query&id=' + id
				})
			},
		}
	}
</script>

<style scoped>
	.head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 128upx;
		background: #ffffff;
		padding: 0 24upx;
		z-index: 200;
		position: fixed;
		top: 0;
		box-sizing: border-box;
	}

	.head image {
		width: 20upx;
		height: 36upx;
		margin-right: 9upx;
	}

	.head_left {
		height: 82upx;
		width: 106upx;
		display: flex;
		align-items: center;
		line-height: 82upx;
		color: #666666;
		font-size: 32upx;
	}

	.head_right {
		width: 120upx;
	}

	.padding-box {
		padding-top: 148upx;
	}

	.item {
		background: #FFFFFF;
		display: flex;
		justify-content: space-between;
		padding: 0 24upx;
		align-items: center;
		height: 88upx;
		color: #666666;
		font-size: 26upx;
		border-bottom: 1upx solid #re6e6e6;
	}

	.item_right {
		display: flex;
		align-items: center;
	}

	.magin2 {
		margin: 0 20upx;
	}

	.item1_left {
		display: flex;
		align-items: center;
	}

	.text2 {
		color: #46CECF;
	}
</style>
